package thread;

import java.io.IOException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Test {
	public static void main(String[] args) throws IOException {
//		test();
	}

	private static void test() {
		class R implements Runnable{
			int id;
			public R(int id){
				this.id = id;
			}
			public void run(){
				System.out.println(Thread.currentThread().getName()+","+id);
			}
		}
		R[] arr = new R[1000];
		for (int i = 0; i < arr.length; i++) {
			arr[i] = new R(i);
		}
		ExecutorService pool = 
			Executors.newFixedThreadPool(2);
//			Executors.newCachedThreadPool();
		for (R r : arr) {
			pool.execute(r);
		}
	}
}
